
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>火车票查询页面</title>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css">
    <script type="text/javascript">
        function checkTrain() {
            var train=document.myform.trainNum;
            if(train.value==""){
                alert("请输入车次");
                return false;
            }
            return true;
        }
        function checkStart() {
            var startStation=document.myform.startStation;
            if(startStation.value==""){
                alert("请输入出发地");
                return false;
            }
            return true;
        }
        function checkEnd() {
            var endStation=document.myform.endStation;
            if(endStation.value==""){
                alert("请输入目的地");
                return false;
            }
            return true;
        }
        function checkAll() {
            if(checkTrain() && checkStart() && checkEnd()){
                return true;
            }
            return false;
        }
    </script>
</head>
<body>
    <div class="container"align="center">
        <div class="row">
            <form class="form-horizontal"name="myform" method="post" action="/train/trainservlet" onsubmit="return checkAll()">
                <h1>查询车票价格</h1>
                <div class="form-group">
                    <label class="col-sm-2 control-label">车次</label>
                    <div class="col-sm-10">
                        <input name="trainNum"id="trainNum" onblur="checkTrain()" value="k339">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">出发地</label>
                    <div class="col-sm-10">
                        <input name="startStation"value="北京" id="startStation" onblur="checkStart()">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">目的地</label>
                    <div class="col-sm-10">
                        <input name="endStation"value="哈尔滨" id="endStation" onblur="checkEnd()">
                    </div>
                </div>
                <button  type="submit">查询</button>
            </form>
        </div>

    </div>
</body>
</html>
